<?php
/**
 * [商网通 System] Copyright swtshop.cn
 * QQ: 1170787711
 * Author: gj.name
 * This is NOT a freeware
*/
defined('IN_UQ') or exit('Access Denied');
class account_uqcms extends control
{
    function __construct()
    {
        $this->uid = @$_SESSION['user']['uid'];
        parent::__construct();
    }
    public function pay()
    {
        $trade_no = isset($_GET['trade_no']) ? $_GET['trade_no'] : showmsg('交易订单错误');
        $result = $this->module('account')->get_trade($trade_no);
        $this->assign('row', $result);
        $this->display();
    }
    public function pay_submit()
    {
        $trade_no = isset($_GET['trade_no']) ? $_GET['trade_no'] : '';
        $payment = isset($_GET['payment']) ? $_GET['payment'] : showmsg('支付方式错误');
        if ($trade_no) {
            $result = $this->module('account')->get_trade($trade_no);
            if ($result['error'] == '0' && $result['price']) {
                $result['pay_type'] = '1';
                $payInfo['trade_no'] = $result['trade_no'];
                $payInfo['title'] = $result['title'];
                $payInfo['price'] = $result['price'];
                $result = $this->module('payment')->pay($payment, $payInfo);
                if (isset($result['tpl'])) {
                    $this->assign('row', $result);
                    $this->display('account/' . $result['tpl']);
                } else {
                    echo $result;
                }
            } else {
                showmsg($result['msg']);
            }
        } else {
            showmsg('提交错误');
        }
    }
    function withdraw_action()
    {
        $id = isset($_POST['id']) ? $_POST['id'] : '';
        $this->module('account')->withdraw_apply($id);
    }
}